﻿
@{
    Layout = null;
}

<div>
    <h2>角色列表</h2>
    
    <div id="p" class="easyui-panel" title="Basic Panel" style="width:700px;height:200px;padding:10px;">
        <p style="font-size:14px">查詢</p>
        <table cellpadding="5">
            <tr>
                <td>itemid:</td>
                <td><input class="easyui-textbox" type="text" id="[like]itemid" data-options="prompt:'Enter itemid...'" style="width:200px;height:32px" /></td>
                <td>productid:</td>
                <td><input class="easyui-textbox" type="text" id="[like]productid" data-options="prompt:'Enter productid...'" /></td>
            </tr>
            <tr>
                <td colspan="4"><a id="btnSearch" href="#none" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查詢</a></td>
            </tr>

        </table>
</div>
    
    <table id="list_data" title="用戶列表" style="width:700px;height:250px"
           data-options="rownumbers:true,singleSelect:true,pagination:true,sortName:'itemid',sortOrder:'asc',url:'@Url.Action("GetUserList", "Organization")',method:'post',toolbar:getToolbar(),queryParams:getQueryParams()">
        <thead>
            <tr>
                <th data-options="field:'itemid',width:80">Item ID</th>
                <th data-options="field:'productid',width:100">Product</th>
                <th data-options="field:'listprice',width:80,align:'right'">List Price</th>
                <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
                <th data-options="field:'attr1',width:240">Attribute</th>
                <th data-options="field:'status',width:60,align:'center'">Status</th>
            </tr>
        </thead>
    </table>
    <script type="text/javascript">
        function getToolbar() {
            return [{
                text: '添加',
                iconCls: 'icon-add',
                handler: function () { alert('添加') }
            }, {
                text: '修改',
                iconCls: 'icon-edit',
                handler: function () { alert('修改') }
            }, '-', {
                text: '删除',
                iconCls: 'icon-remove',
                handler: function () { alert('删除') }
            }];
        }

        function getQueryParams() {
            //debugger;
            var query = {
                like_itemid: $("#\\[like\\]itemid").val(),
                like_productid: $("#\\[like\\]productid").val()
            };
            return query;
        }
        

        $(function () {

            var $datagrid = $('#list_data');

            var pager = $datagrid.datagrid().datagrid('getPager');	// 獲取分頁控件

            $("#btnSearch").on("click", function () {

                $datagrid.datagrid('options').queryParams = getQueryParams();
                $datagrid.datagrid('load');
            });
        });
    </script>
</div>
